package com.xzc.datastruc.ujava.c06._0;

public class MyContainerIterator {
    private int current = 0;
    private MyContainer myContainer;

    /**
     * iterator需要知道container的信息
     */
    public MyContainerIterator(MyContainer c) {
        this.myContainer = c;
    }

    public boolean hasNext() {
        return current < myContainer.size;
    }

    /**
     * 耦合了Item的获取与current的步进
     * 而且没有向后迭代的功能
     */
    public Object next() {
        return myContainer.items[current++];
    }
}
